package cs236369.hw5;

import java.util.ArrayList;

public class Skill {

	/**
	 * @param id skill id - set automatically for new skills in the system
	 * @param skill the name of the skill
	 * @param available is the skill is available to use, or just being used in old posts
	 */
	public Skill(int id, String skill, boolean available) {
		super();
		this.id = id;
		this.skill = skill;
		this.available = available;
	}
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}
	/**
	 * @return the skill name
	 */
	public String getSkill() {
		return skill;
	}
	/**
	 * @return if available
	 */
	public boolean isAvailable() {
		return available;
	}

	/**
	 * Finds a skill in an array of skills by ID
	 * @param skills - the array
	 * @param skillID - the ID of the skill
	 * @return the skill or null if skill isn't found
	 */
	public static Skill findSkillById(ArrayList<Skill> skills, int skillID){
		for(Skill s : skills){
			if(s.getId()==skillID)
				return s;
		}
		return null;
	}
	
	private int id;
	private String skill;
	private boolean available;
}
